<template>
  <div id="writePoint">
  <group>
      <x-textarea :max="20" placeholder="新鲜事" v-model="content" @on-focus="onEvent('focus')" @on-blur="onEvent('blur')" ref='content'></x-textarea>
  </group>
  
  <x-button :text="submit001" :disabled="disable001" @click.native="processButton001" type="primary" style="background-color:rgb(216, 65, 65) !important;"></x-button>

  </div>
</template>

<script>

import { Grid, XTextarea, Group, XButton } from 'vux'

export default {
  components: {
    Grid,
    XTextarea,
    Group,
    XButton
  },
  data () {
    return {
      items: [],
      submit001: '发布',
      disable001: false,
      content: ''
    }
  },
  mounted: function () {
  },
  methods: {
    refresh: function (done) {
    },
    onEvent (event) {
      console.log('on', event)
    },
    processButton001 () {
      this.submit001 = 'processing'
      this.disable001 = true
      var txt = this.content
      console.log(txt)
      let config = {
        headers: {'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/json'},
        data: {
          pointText: txt
        },
        method: 'post'
      }
      this.$ajax('home/api/cms/viewpoints/add', config).then(function (response) {
        console.log(response)
      }).catch(function (error) {
        console.log(error)
      })
    }
  }
}
</script>

<style scoped>

</style>
